from api.login_api import LoginApi


def get_headers(mobile="13800000002", password="123456"):
    # 1.发送登录请求
    body = {"mobile": mobile, "password": password}
    resp = LoginApi().login(body)
    # 2.获取响应体中的令牌 data = "xxxxxxx"  拼接令牌
    token = "Bearer " + resp.json().get("data")
    # 3. 组装一个字典 headers 包含Authorization
    # {"Authorization": "Bearer d3133677-2048-4296-8f6f-b401fd6e1e27"}
    headers = {"Authorization": token}
    return headers
